n=int(input())
fen=[]
for i in range(n):
    fenshu=int(input())
    fen.append(fenshu)
a=max(fen)
b=min(fen)
print(a)
print(b)
